import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import Antd from 'ant-design-vue';
import 'ant-design-vue/dist/antd.less';
import './permission.js'

Vue.use(Antd);

Vue.config.productionTip = false

Vue.directive('watermark',(el,binding)=>{
  function addWaterMarker(str,parentNode,font,textColor){// 水印文字，父元素，字体，文字颜色
      var can = document.createElement('canvas');
      parentNode.appendChild(can);
      can.width = 250;
      can.height = 150;
      can.style.display = 'none';
      var cans = can.getContext('2d');
      cans.rotate(-15 * Math.PI / 180);
      cans.font = font || "16px Microsoft JhengHei";
      cans.fillStyle = textColor || "rgba(180, 180, 180, 0.3)";
      cans.textAlign = 'left';
      cans.textBaseline = 'Middle';
      cans.fillText(str, can.width / can.width, can.height / 2);
      parentNode.style.backgroundImage = "url(" + can.toDataURL("image/png") + ")";
      parentNode.style.width = '100%';
      parentNode.style.height = '100%';
      parentNode.style.position = 'absolute';
      parentNode.style.top = '0';
      parentNode.style.left = '0';
      parentNode.style.zIndex = '100000';
      parentNode.style.pointerEvents = 'none';
  }
  addWaterMarker(binding.value.text, el, binding.value.font, binding.value.textColor);
});


new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
